#ifndef pkm_sub_texture_h
#define pkm_sub_texture_h

#include "AbstractTexture.h"
#include "RawTexture.h"

namespace k2graphics
{

class SubTexture : public AbstractTexture
{
public:
	// Woo.. yay... 
	SubTexture();
	SubTexture(AbstractTexture* rawTex);

	// if you want to set the scaling and translation manually
	void setTS(float ncx, float ncy, float nsx, float nsy);
	// if you want to specify a rectangle that (0,0) - (1,1) maps to
	void setSubRect(float left, float top, float width, float height);

	GLuint getRawGLTexture(int* params, int numParams);
	GLuint getRawGLTexture();
	void getRawTextureCoordinates(float sx, float sy, float &dx, float &dy);
	void getRawTextureCoordinates(int* params, int numParams, float sx, float sy, float &dx, float &dy);

	int getTextureType();
private:
	AbstractTexture* srcTexture;

	// scaling and translation, but no rotation
	float cx;
	float cy;
	float mx;
	float my;
};

}
#endif
